package estyle.auto.nkornilova.applogicImp;

import estyle.auto.nkornilova.model.User;

public class UserHelper extends DriverBasedHelper  {

    public UserHelper(ApplicationManager applicationManager) {
        super(applicationManager.getWebDriver());
    }

    public void loginAs(User user) {
        pages.loginPage
                .ensurePageLoaded()
                .setUsernameField(user.getLogin())
                .setPasswordField(user.getPassword())
                .clickSubmitButton();
    }

    public void logout() {
        //this.user=null;
        //wait.until(alertIsPresent()).accept();
    }

    public boolean isLoginAs() {
        return pages.mainPage.isVisible();
    }

    public boolean isLoggedInAs(User user) {
        return true;
    }

}
